package com.igitalExplorer.SketchDemo.utils;

import java.math.BigDecimal;

public class DrawUtils {
    //方位角转换为普通角
    public static double azimuthConverse(double azimuth) {
        if (azimuth >= 0 && azimuth < 90) {
            return 90 - azimuth;
        } else {
            return 450 - azimuth;
        }
    }

    //角度转弧度
    public static double radianConverse(double angle) {
        return angle * Math.PI / 180;
    }

    //弧度转角度
    public static double angleConverse(double radian) {
        return 180 * radian / Math.PI;
    }

    //四舍五入double数据
    public static double getDoubleScale(double doubleNumber, int scaleNumber) {
        return BigDecimal.valueOf(doubleNumber).setScale(scaleNumber, BigDecimal.ROUND_HALF_UP).doubleValue();
    }
}
